package com.wnx.job.modules.pms.controller;

import com.wnx.job.common.api.Const;
import com.wnx.job.common.api.ResultData;
import com.wnx.job.domain.CascadeNode;
import com.wnx.job.modules.pms.service.PmsPostTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wangnaixing
 * @since 2021-12-17
 */
@Slf4j
@RestController
@RequestMapping("/pms/pmsPostType")
@Api(tags = "PostTypeController",description = "职位类型管理")
public class PmsPostTypeController {
    @Resource
    private PmsPostTypeService postTypeService;

    /**
     * 获取职位类型树
     * @return
     */
    @GetMapping("/getPostTypeTree")
    @ApiOperation("获取职位类型树")
    public ResultData<List<CascadeNode>> getPostTypeTree(){
        log.info("====系统正在获取职位类型树！！==========");

        //调用服务层，获取职位类型树
        List<CascadeNode> postTypeTree =  postTypeService.getPostTypeTree();

        //返回结果集对象
        log.info("====系统成功获取到职位类型树！！==========");

        return ResultData.success(Const.QUERY_POST_TYPE_TREE_SUCCESS,postTypeTree);

    }


}

